const Koa = require('koa')
const Router = require('koa-router')
const cors = require('koa2-cors') // cors 跨域配置

const app = new Koa()
app.use(cors())
const router = new Router()

router.get('/api/list', async ctx => {
  ctx.body = {
    status: 200,
    msg: 'success',
    data: [{id: 4001, name: 'test2'}]
  }
})

app.use(router.routes())

app.listen(4001, () => {
  console.log('Serve in 4001')
})
